/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session08;

import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author sinhnx <sinhnx@fpt.aptech.ac.vn>
 */
public class HelloServer {

    public static void main(String[] args) {
        try {
            HelloRemote objRemote = new HelloRemote();
            
            Registry registry = LocateRegistry.createRegistry(1099);
            try {
                Naming.bind("rmi://localhost:1099/HelloServer", objRemote);
            } catch (AlreadyBoundException ex) {
                Logger.getLogger(HelloServer.class.getName()).log(Level.SEVERE, null, ex);
            } catch (MalformedURLException ex) {
                Logger.getLogger(HelloServer.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (RemoteException ex) {
            Logger.getLogger(HelloServer.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
